package com.itheima.a23.sub;

import org.springframework.core.GenericTypeResolver;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * @author: AirMan
 * @date: 2025/4/18 15:37
 * @description:
 */
public class MyTestGeneicType {
    public static void main(String[] args) {

        Type type = StudentDao.class.getGenericSuperclass();

        System.out.println(type);
        // jdk ==> ParameterizedType
        if (type instanceof ParameterizedType parameterizedType) {
            System.out.println(parameterizedType.getActualTypeArguments()[0]);
        }

        // spring ==> GenericTypeResolver.resolveTypeArgument
        Class<?> t = GenericTypeResolver.resolveTypeArgument(TeacherDao.class, BaseDao.class);
        System.out.println(t);

    }
}
